package com.liuwei.msmall.ware.dao;

import com.liuwei.msmall.ware.entity.WareSkuEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 商品库存
 * 
 * @author llww
 * @email 2456888577@qq.com
 * @date 2021-02-25 17:06:18
 */
@Mapper
public interface WareSkuDao extends BaseMapper<WareSkuEntity> {

    Long selectHasStockBySkuId(@Param("skuid") Long skuid);

    List<Long> selectWareIdHasStock(@Param("skuId") Long skuId);

    Long lockWareStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("countNum") int countNum);

    void unlockWareStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("skuNum") Integer skuNum);

}
